package com.wbsxch.secondkill.service;

import com.wbsxch.secondkill.dto.Exposer;
import com.wbsxch.secondkill.dto.SecondKillExecution;
import com.wbsxch.secondkill.entity.SecondKill;
import com.wbsxch.secondkill.exception.RepeatKillException;
import com.wbsxch.secondkill.exception.SecondKillCloseException;

import java.util.List;

public interface SecondKillService {

    /**
     * 查询所有秒杀记录
     */
    List<SecondKill> selectAll();

    /**
     * 查询单个秒杀记录
     */
    SecondKill selectById(long secondKillId);

    /**
     * 秒杀开启时输出秒杀接口地址，否则输出系统时间和秒杀时间
     */
    Exposer exportSecondKillUrl(long secondKillId);

    /**
     * 执行秒杀操作
     */
    SecondKillExecution executeSecondKill(long secondKillId,long phone,String md5) throws Exception,RepeatKillException,SecondKillCloseException;
}
